/*
 * @Author: Setsuna
 * @Email: setsuna.xyz@qq.com
 * @FilePath: \src\pages\QuotaManage\StockCheck\QuatoDetail\component\InputNumberLinkOrder.tsx
 * @Date: 2022-05-31 14:21:31
 * @LastEditTime: 2022-05-31 14:56:13
 */

import { Button, Col, InputNumber, Row } from "antd"
import { InputNumberProps } from "antd/lib/input-number"
import React from "react"

function InputNumberLinkOrder(props: InputNumberLinkOrderProps) {
  const { buttonText = '关联订单',handLinkOrders,calcNowMove, ...rest } = props

  return (
    <Row>
      <Col span={20}>
        <InputNumber onBlur={calcNowMove} precision={1} style={{ width: '100%' }} {...rest} />
      </Col>
      <Col span={3} offset={1}>
        <Button type="primary" onClick={handLinkOrders}>
          {buttonText}
        </Button>
      </Col>
    </Row>
  )
}

const InputNumberLinkOrderRef = React.forwardRef((props: any, ref) => {
  return <InputNumberLinkOrder {...props} />
})

export default React.memo(InputNumberLinkOrderRef)

interface InputNumberLinkOrderProps extends InputNumberProps {
  buttonText: string
  handLinkOrders: () => void
  calcNowMove:()=>void
}